﻿<UserControl x:Class="Xinnos.Lca.Yacht.Analyzer.View.WorkBreakdownStructureTabPanel"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:this="clr-namespace:Xinnos.Lca.Yacht.Analyzer.View" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.CommandBindings>
        <CommandBinding Command="New" CanExecute="OnCanExecuteNewCommand" Executed="OnExecuteNewCommand" />
        <CommandBinding Command="Replace" CanExecute="OnCanExecuteReplaceCommand" Executed="OnExecuteReplaceCommand" />
        <CommandBinding Command="Delete" CanExecute="OnCanExecuteRemoveCommand" Executed="OnExecuteRemoveCommand" />
    </UserControl.CommandBindings>
    <Grid>
        <TabControl ItemsSource="{Binding Groups}" SelectedItem="{Binding Group}" DisplayMemberPath="Name">
            <TabControl.ContextMenu>
                <ContextMenu>
                    <MenuItem Command="New" CommandTarget="{Binding Path=PlacementTarget,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ContextMenu}}}" />
                    <MenuItem Command="Replace" CommandTarget="{Binding Path=PlacementTarget,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ContextMenu}}}" />
                    <MenuItem Command="Delete" CommandTarget="{Binding Path=PlacementTarget,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ContextMenu}}}" />
                </ContextMenu>
            </TabControl.ContextMenu>
            <TabControl.ContentTemplate>
                <DataTemplate>
                    <this:WorkBreakdownStructureTreePanel DataContext="{Binding}" Margin="5" />
                </DataTemplate>
            </TabControl.ContentTemplate>
        </TabControl>
    </Grid>
</UserControl>
